package org.pkg.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.event.dom.client.ClickEvent;

public class Calculator extends Composite {

	private static CalculatorUiBinder uiBinder = GWT
			.create(CalculatorUiBinder.class);
	@UiField TextBox txtNum1;
	@UiField TextBox txtNum2;
	@UiField Button btnCalcular;
	@UiField TextBox txtResultado;

	interface CalculatorUiBinder extends UiBinder<Widget, Calculator> {
	}

	public Calculator() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiHandler("btnCalcular")
	void onBtnCalcularClick(ClickEvent event) {
		this.txtResultado.setText(Double.toString(Double.parseDouble(txtNum1.getText()) - Double.parseDouble(txtNum2.getText())));
	}
}
